<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" src="http://121.40.188.62/editorJfinalProject/js/jquery-1.7.1.js"></script>
    <script>
        //        $(document).ready(function(){
        //            $("#a").click(function(){
        //               alert("ss")
        //            });
        //        })
        function clicks(){
            var json = {
                contry:{
                    area:{
                        man:"12万",
                        women:"10万"
                    }
                }
            };
//            var obj = eval(json);
//            alert(obj.constructor);
//            alert(obj.contry.area.women);
            alert(json.contry.area.man)
        }

        function test2(){
            var strJSON = "{name:'json name'}";//得到的JSON
            var obj = new Function("return" + strJSON)();//转换后的JSON对象
            alert(obj.name);//json name
            alert(obj.constructor);
        }

        function test3(){
            var value1 = [
                {"c01":"1","c02":"2","c03":"3","c04":"4","c05":"5","c06":"6","c07":"7","c08":"8","c09":"9"},
                {"c01":"2","c02":"4","c03":"5","c04":"2","c05":"8","c06":"11","c07":"21","c08":"1","c09":"12"},
                {"c01":"5","c02":"1","c03":"4","c04":"11","c05":"9","c06":"8","c07":"1","c08":"8","c09":"2"}
            ];
            var obj1 = eval(value1);
            var temp = obj1.length;
            alert(obj1[2].c09+"-----"+temp);
        }

        function test4(){
            var value2 = {
                "list":[
                    {"password":"1230","username":"coolcooldool"},
                    {"password":"thisis2","username":"okokok"}
                ],
                "array":[
                    {"password":"1230","username":"coolcooldool"},
                    {"password":"thisis2","username":"okokok"}
                ]
            };
            var obj2 = eval(value2);
            temp1 = obj2.length;
            temp2 = obj2.list.length;
//            alert(obj2.constructor);
            alert(obj2.list[0].password+"-----"+temp1+"-----"+temp2);
        }

        window.onload = function(){
            $.post("http://localhost:8080/editorJfinalProject/page/fortest",{name:"me"},function(date){
//                alert(date);
                var obj = eval(date);
//                alert(obj.constructor);
//                alert(obj.ss[0].c01);
                var obj2 = eval(obj.ss);
                var n = obj2.length;
                    alert(obj2[0].c09);
//                document.write(obj.ss[0].c01);
                for(var i=0;i<n;i++){
                    document.getElementById("comment").innerHTML+="<li style='margin: 0;padding: 0'>"+obj2[i].c03+"</li>"
                }
            });


        }
    </script>
</head>
<body>
<input type="button" value="button" onclick="test2();"/>
<input type="button" value="button2" onclick="clicks()"/>
<input type="button" value="button3" onclick="test3()"/>
<input type="button" value="button3" onclick="test4()"/>
<form action="http://localhost:8080/editorJfinalProject/page/fortest" method="post">
    <input type="text" name="name"/>
    <button type="submit">tijiao</button>
</form>
<div id="mydiv">
    <ul id="comment" style="list-style: none">

    </ul>
</div>
</body>
</html>